﻿using HC.View;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EMRView;
using EMRView.Extensions.HCAttribute;

namespace EMRView.Extensions.Command.StandardCommand.File
{
    [Command(CommandType.文件, "PrintFile", "打印文件")]
    public class PrintFileCommand : BaseCommand
    {
        public override Icon CommandIcon
        {
            get
            {
                return Properties.HCResource.打印;
            }
        }
        public override object Execute(HCEmrView _view, bool showDefaultUI = false, params object[] para)
        {
            using (PrintDialog vPrintDlg = new PrintDialog())
            {
                vPrintDlg.PrinterSettings.MaximumPage = _view.PageCount;
                if (vPrintDlg.ShowDialog() == DialogResult.OK)
                    _view.Print(vPrintDlg.PrinterSettings.PrinterName);
            }
            return null;
        }

        public override void InitControl(object control)
        {

        }
    }
}
